<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="_fragment::head(~{::title})">
    <meta charset="UTF-8">
    <meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
    <title>标签管理</title>
    <link href="../../static/css/semantic.min.css" rel="stylesheet">
    <link href="../../static/css/style.css" rel="stylesheet">
</head>
<body>
<!--导航 -->
<nav th:replace="admin/_fragment::menu(3)" class="ui inverted attached segment m-padding-tb-mini m-shadow-small">
    <div class="ui container">
        <div class="ui inverted secondary stackable menu">
            <h2 class="ui teal header item">管理后台</h2>
            <a href="#" class="m-item item m-mobile-hide"><i class="home mini icon"></i>博客</a>
            <a href="#" class="m-item item m-mobile-hide"><i class="idea mini icon "></i>分类</a>
            <a href="#" class="m-item item m-mobile-hide"><i class="tags mini icon"></i>标签</a>
            <div class="right m-item item m-mobile-hide">
               <div class="ui dropdown item">
                   <div class="text">
                       <img src="../../static/images/girl.jpeg" alt="" class="ui avatar image">
                       彭阳宴
                   </div>
                   <i class="dropdown icon"></i>
                   <div class="menu">
                       <a href="#" class="item">注销</a>
                   </div>
               </div>
            </div>
        </div>
    </div>
    <div class="ui menu toggle black icon button m-right-top m-mobile-show">
        <i class="sidebar icon"></i>
    </div>
</nav>

<!-- 中间内容 -->
<div class="m-container-small m-padding-tb-small m-container-height">
    <div class="ui container">
        <div class="ui message" th:unless="${#strings.isEmpty(message)}" th:classappend="${status}?'success':'error'">
            <i class="close icon"></i>
            <div class="header">提示:</div>
            <p th:text="${message}">恭喜,操作成功</p>
        </div>
        <table class="ui stackable celled padded table">
            <thead>
                <tr>
                    <th></th>
                    <th>标签名称</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                <tr th:each="tag,iterStat: ${page.content}">
                    <th th:text="${iterStat.index + 1}">1</th>
                    <th th:text="${tag.name}">Java</th>
                    <th>
                        <a href="#" th:href="@{/admin/tags/{id}/input(id=${tag.id})}" class="ui mini basic teal button">编辑</a>
                        <a href="#" class="ui mini red basic button" th:onclick="|deleteTag(${tag.id})|">删除</a>
                    </th>
                </tr>
            </tbody>
            <tfoot>
                <tr>
                    <th colspan="6">
                        <div class="ui pagination mini menu">
                            <a th:href="@{/admin/tags(page=${page.number - 1})}" class="item" th:unless="${page.first}">上一页</a>
                            <a th:href="@{/admin/tags(page=${page.number + 1})}" class="item" th:unless="${page.last}">下一页</a>
                        </div>
                        <a class="ui teal basic right floated button"  th:href="@{/admin/tags/input}">新增</a>
                    </th>
                </tr>
            </tfoot>
        </table>
    </div>
</div>
<div class="ui small modal">
    <div class="ui icon header">
        <i class="archive icon"></i>
        确认删除当前标签？
    </div>
    <div class="actions">
        <div class="ui red basic cancel inverted button">
            <i class="remove icon"></i>
            No
        </div>
        <a id="deleteTag" class="ui green ok inverted button" href="#">
            <i class="checkmark icon"></i>
            Yes
        </a>
    </div>
</div>

<!-- 底部footer -->
<footer th:replace="admin/_fragment::footer" class="ui inverted vertical segment m-margin-top-small">
    <div class="ui center aligned container">
        <div class="ui stackable inverted divided grid m-padding-tb-big">
            <div class="three wide column">
                <div class="ui item">
                    <img src="../../static/images/girl.jpeg" alt="" class="ui rounded image m-inline-block" style="width: 100px;">
                </div>
            </div>
            <div class="three wide column">
                <h4 class="ui inverted header m-text-thin m-text-spaced">最新博客</h4>
                <div class="ui inverted link list">
                    <a href="#" class="item">用户故事{ user story }</a>
                    <a href="#" class="item">用户故事{ user story }</a>
                    <a href="#" class="item">用户故事{ user story }</a>
                </div>
            </div>
            <div class="three wide column">
                <h4 class="ui inverted header m-text-thin m-text-spaced">最新博客</h4>
                <div class="ui inverted link list">
                    <a href="#" class="item">用户故事{ user story }</a>
                    <a href="#" class="item">用户故事{ user story }</a>
                    <a href="#" class="item">用户故事{ user story }</a>
                </div>
            </div>
            <div class="seven wide column">
                <h4 class="ui inverted header m-text-thin m-text-spaced">最新博客</h4>
                <p class="m-text-thin m-text-spaced m-opacity-mini">xxxxxxxxxxxxxxxxxxxx</p>
            </div>
        </div>
        <div class="ui inverted selection divider"></div>
        <p class="m-text-thin m-text-spaced m-opacity-tiny">Copyright © 2020 - 2021 Mr.Peng</p>
    </div>
</footer>

<!--/*/<th:block th:replace="admin/_fragment::script">/*/-->
<script src="../../static/js/jquery.min.js"></script>
<script src="../../static/js/semantic.min.js"></script>
<!--/*/</th:block>/*/-->

<script>
    $('.menu.toggle').click(function () {
      $('.m-item').toggleClass('m-mobile-hide')
    });
    $('.ui.dropdown').dropdown({
      on: 'hover'
    })
    $('.message .close')
        .on('click', function() {
            $(this)
                .closest('.message')
                .transition('fade')
            ;
        })
    ;
    function deleteTag(item){
        var href = "/admin/tags/"+item+"/delete";
        var element = document.getElementById("deleteTag");
        element.setAttribute("href",href);
        $('.ui.small.modal').modal('show');
    }

</script>
</body>
</html>